.container {
    min-height: 100vh;
    background-color: #F8F9FD;
    position: relative;
}

/* 添加固定顶部样式 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #F8F9FD;
    z-index: 999;
}


/* 确保内容区域在固定头部下方 */
.content {
    background-color: #f5f5f5;
    min-height: 100vh; /* Use min-height instead of fixed height */
    position: relative;
    overflow-y: auto; /* Allow vertical scrolling */
    padding-bottom: 100rpx; /* Add some bottom padding to ensure full scrollability */
    margin-bottom: 210rpx;
}

/* 顶部安全区域 */
.safe-area {
    height: 120rpx;
    width: 100%;
}

/* 顶部欢迎区样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40rpx 20rpx;
    padding: 0 10rpx;
}

/* 内容区域添加上边距 */
.header-placeholder {
    height: 280rpx; /* 这个高度需要和fixed-header的实际高度匹配 */
}

.welcome {
    display: flex;
    flex-direction: column;
}

.welcome-text {
    font-size: 35rpx;
    color: #666;
    margin-bottom: 8rpx;
}

.name {
    font-size: 40rpx;
    font-weight: bold;
    color: #333;
}

.avatar {
    margin-top: 10rpx;
    width: 100rpx;
    height: 100rpx;
    border-radius: 50%;
    background-color: #eee; /* 图片加载前的背景色 */
}


/* 添加新的样式 */
.card-swiper {
    margin-top: 40rpx;
    height: 270rpx;
    width: 100%;
    margin-left: 27rpx;
}

/* 天气卡片样式 */
.weather-card {
    background: linear-gradient(211.5deg, #4C6FFF 0%, #6B8CFF 100%);
    border-radius: 30rpx;
    padding: 40rpx;
    color: white;
    margin-bottom: 40rpx;
    margin-left: 20rpx;
    margin-right: 15rpx;
    height: 190rpx;
    width: 570rpx;
    background-size: cover;
    background-position: center;
    position: relative;
}

/* 天气背景样式 */
.weather-sunny {
    background: linear-gradient(211.5deg, #4C6FFF 0%, #6B8CFF 100%);
    background-image: url('../../static/晴天.png');
}

.weather-rainy {
    background: linear-gradient(211.5deg, #4C6FFF 0%, #6B8CFF 100%);
    background-image: url('../../static/雨天.png');
}

.weather-cloudy {
    background: linear-gradient(211.5deg, #4C6FFF 0%, #6B8CFF 100%);
    background-image: url('../../static/多云.png');
}

/* 添加渐变遮罩，确保文字清晰可见 */
.weather-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.3),
            rgba(0, 0, 0, 0.1)
    );
    border-radius: 30rpx;
}

/* 确保内容在遮罩层上方 */
.weather-card > * {
    position: relative;
    z-index: 1;
}

.weather-header {
    font-size: 35rpx;
    margin-bottom: 20rpx;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.weather-title {
    display: flex;
    flex-direction: column;
    gap: 8rpx;
}

.location-text {
    font-size: 24rpx;
    opacity: 0.8;
    font-weight: normal;
}

.weather-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 20rpx;
}


.weather-temp {
    font-size: 60rpx;
    font-weight: bold;
}

.weather-info {
    display: flex;
    flex-direction: column;
}

.weather-desc {
    font-size: 32rpx;
    margin-bottom: 8rpx;
}

.weather-range {
    font-size: 24rpx;
    opacity: 0.8;
}

.weather-extra {
    display: flex;
    flex-direction: column;
    gap: 15rpx;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 12rpx;
}

.weather-label {
    font-size: 24rpx;
    opacity: 0.8;
}

.weather-value {
    font-size: 24rpx;
    font-weight: 500;
}

/* 能源卡片样式 */
.energy-card {
    background: linear-gradient(211.5deg, rgba(247, 117, 156, 1) 0%, rgba(255, 107, 161, 1) 100%);
    border-radius: 30rpx;
    padding: 40rpx;
    color: white;
    margin-bottom: 40rpx;
    margin-left: 20rpx;
    height: 190rpx;
    width: 580rpx;
    display: flex;
    flex-direction: column;
}

.energy-card .line {
    left: 106px;
    top: 1050px;
    width: 287px;
    height: 0.5px;
    opacity: 0.3;
    transform: rotate(-0.1deg);
    border: 1px solid rgba(255, 255, 255, 1);
    margin-bottom: 20rpx;
}

.energy-card .energy-usages {
    color: white;
    font-size: 35rpx;
    margin-bottom: 20rpx;
}

.energy-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30rpx;
    margin-top: 10rpx;
}

.energy-label {
    font-size: 24rpx;
    opacity: 0.8;
}

.energy-value {
    font-size: 38rpx;
    font-weight: bold;
    margin-top: 10rpx;
}

.energy-icon {
    margin-right: 5rpx;
}

/* 修改原有的样式 */
.energy-usages, .weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20rpx;
}

.usage-icon {
    width: 40rpx;
    height: 40rpx;
    opacity: 0.8;
}


/* 添加或修改滑动指示点的样式 */
.dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12rpx;
    margin: 20rpx 0;
}

.dot {
    width: 12rpx;
    height: 12rpx;
    background-color: #E0E0E0;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dot.active {
    width: 35rpx;
    background: rgba(154, 155, 158, 1);
    border-radius: 6rpx;
}

/* 房间选择器样式 */
.room-selector {
    display: flex;
    justify-content: space-around;
    gap: 30rpx;
    margin-bottom: 40rpx;
    position: relative;
}

/* 按钮样式 */
.room-option {
    font-size: 30rpx;
    color: #999;
    padding-bottom: 10rpx;
    position: relative;
    transition: all 0.3s ease;
}

/* 选中状态 */
.room-option.active {
    color: #333;
    font-weight: bold;
}

/* 滑动线条 (仍然使用 ::after) */
.room-selector::after {
    content: '';
    position: absolute;
    bottom: -10%;
    height: 6rpx;
    background-color: #4C6FFF;
    transition: all 0.3s ease;
    width: 60rpx;
}

/* 让 `::after` 正确移动 */
.room-selector.all::after {
    left: calc(12% - 35rpx); /* "全部" 居中对齐 */
}

/* 动态计算 `room-${id}` 对应的滑动位置 */
.room-selector.room-1::after {
    left: calc(37.5% - 35rpx);
}

.room-selector.room-2::after {
    left: calc(63.5% - 35rpx);
}

.room-selector.room-3::after {
    left: calc(89.5% - 35rpx);
}

/* 点击时的缩放动画 */
.room-option:active {
    transform: scale(1.2);
    transition: transform 0.2s ease;
}

/* 设备卡片样式 */
.device-cards {
    height: 500rpx;
    margin-left: 15rpx;
}

.device-card {
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
    gap: 30rpx;
    background: rgba(255, 255, 255, 1);
    border-radius: 30rpx;
    padding: 40rpx;
    color: white;
    margin-bottom: 40rpx;
    margin-left: 35rpx;
    height: 190rpx;
    width: 580rpx;
    display: flex;
    flex-direction: column;
    position: relative;
    /* 修改过渡动画 */
    transition: transform 0.6s;
    transform-origin: center;
    opacity: 1;
    perspective: 2000rpx;
    transform-style: preserve-3d;
}

/* 卡片正面和背面的共同样式 */
.card-front{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    border-radius: 30rpx;
    background: rgba(255, 255, 255, 1);
    padding: 40rpx;
    box-sizing: border-box;
}


/* 翻转状态 */
.card-flipped {
    transform: translateZ(-100rpx) rotateY(180deg);
}

.device-header {
    display: flex;
    align-items: center;
    margin-bottom: 30rpx;
}

.device-icon {
    width: 80rpx;
    height: 80rpx;
    background: #F0F3FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20rpx;
}

.device-icon image {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.device-card .device-info {
    display: flex;
    flex-direction: column;
}

.device-title {
    font-size: 30rpx;
    font-weight: bold;
    color: #333;
}

.device-subtitle {
    font-size: 28rpx;
    color: #999;
}

.device-data {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.temp-data {
    display: flex;
    gap: 20rpx;
}

.temp-value, .humidity-value {
    font-size: 32rpx;
    color: #333;
    font-weight: bold;
}

.device-sort {
    position: absolute;
    right: 40rpx;
    width: 90rpx;
    height: 40rpx;
    border-radius: 15rpx;
    background: rgba(247, 247, 249, 1);
    font-size: 28rpx;
    color: #999;
    padding-left: 30rpx;
    padding-top: 10rpx;
}

.temp-item, .humidity-item {
    display: flex;
    align-items: center;
    gap: 8rpx;
}

.weather-icon {
    width: 38rpx;
    height: 38rpx;
}

.temp-data {
    display: flex;
    gap: 30rpx; /* 增加间距 */
}

.temp-value, .humidity-value {
    font-size: 32rpx;
    color: #333;
    font-weight: bold;
}

.chart-container {
    width: 100%;
    height: 100%;
    min-height: 200px; /* 确保有足够的高度显示图表 */
}


/* 底部导航栏样式 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120rpx;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
    z-index: 999; /* 确保导航栏在最上层 */
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tab-item.active {
    color: #4C6FFF;
}

/* 激活状态下的文字颜色 */
.tab-item.active .tab-text {
    color: #333;
    font-weight: 500;
    transform: scale(1.05);
}

.tab-icon {
    width: 48rpx;
    height: 48rpx;
    margin-bottom: 6rpx;
    transition: all 0.3s ease-in-out;
}

/* 设置图标旋转动画 */
.tab-item[data-tab="setting"].active .tab-icon {
    transform: rotate(180deg);
}

/* 其他图标放大动画 */
.tab-item:not([data-tab="setting"]).active .tab-icon {
    transform: scale(1.1);
}

.tab-text {
    font-size: 24rpx;
    transition: all 0.3s ease-in-out;
    color: #666;
}

.tab-item-center {
    transform: translateY(-30rpx);
    position: relative;
    z-index: 10;
}

/* 中间按钮样式 */
.center-button {
    width: 100rpx;
    height: 100rpx;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #4C6FFF;
    padding: 20rpx;
    box-shadow: 0 4rpx 8rpx rgba(76, 111, 255, 0.3);
}

/* 激活状态的样式 */
.center-button.active {
    background-color: #FF69B4;
    box-shadow: 0 4rpx 8rpx rgba(255, 105, 180, 0.3);
    animation: bounceAndRotate 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.center-button image {
    width: 60%;
    height: 60%;
    filter: brightness(0) invert(1);
}

.center-button.active image {
    filter: brightness(0) invert(1);
}

/* 组合动画 */
@keyframes bounceAndRotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15rpx) rotate(180deg);
    }
}

/* 添加点击效果 */
.center-button:active {
    transform: scale(0.95);
}

/* 移除原来的加号样式 */
.center-icon {
    display: none;
}

/* 位置信息样式 */
.location-info {
    display: flex;
    flex-direction: column;
    gap: 8rpx;
}

.city-name {
    font-size: 36rpx;
    font-weight: 500;
}

.weather-left {
    display: flex;
    flex-direction: column;
    gap: 10rpx;
}

.temp-display {
    display: flex;
    align-items: flex-start;
}

.temp-number {
    font-size: 72rpx;
    font-weight: 600;
    line-height: 1;
}

.temp-unit {
    font-size: 32rpx;
    margin-top: 8rpx;
    margin-left: 4rpx;
}

.weather-desc {
    font-size: 28rpx;
    opacity: 0.9;
}

.weather-right {
    display: flex;
    flex-direction: column;
    gap: 16rpx;
}

/* 卡片背面 */
.card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    background: rgba(255, 255, 255, 1);
    transform: rotateY(180deg);
    transition: transform 0.6s;
}

/* 翻转状态 */
.card-flipped .card-front {
    transform: rotateY(180deg);
}

.card-flipped .card-back {
    transform: rotateY(360deg);
}
